/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.fancy.applicaiton.tools.htmltox.controller;




import com.fancy.applicaiton.tools.htmltox.service.IFancyToolsHtml2PdfService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * @author wison.wu
 */
@RestController
@RequestMapping(value = "/pdf")
public class FancyToolsHtmlToPdfController {
    private final Logger logger =  LoggerFactory.getLogger(this.getClass());
    @RequestMapping()
    public String index(){
          
        return "success";
    }

    @RequestMapping(value="/url",method = RequestMethod.POST)
    public String pdf(@RequestParam("fdUrl") String fdUrl){
        String path = fancyToolsHtml2PdfService.getPdf(fdUrl);
        return path;
    }
    @RequestMapping(value="/content",method = RequestMethod.POST)
    public String pdfContent(@RequestParam("fdContent") String fdContent){
        String path = fancyToolsHtml2PdfService.getPdfContent(fdContent);
        return path;
    }

    @Autowired
    private IFancyToolsHtml2PdfService fancyToolsHtml2PdfService;
}
